<template>
    <div>
        <el-form :model="search_form"
            class="search_prod"
            label-width="120px">
            <el-form-item label="管理员：">
                <el-col :span="4">
                    <el-col :span="16"
                        class="search_input_width">
                        <el-input size="small"
                            clearable
                            v-model="search_form.username"></el-input>
                    </el-col>
                </el-col>
                <el-col class="tr col_label"
                    :span="3">操作记录：&nbsp;&nbsp;&nbsp;</el-col>
                <el-col :span="4">
                    <el-col :span="16"
                        class="search_input_width">
                        <el-input size="small"
                            clearable
                            v-model="search_form.log_info"></el-input>
                    </el-col>
                </el-col>
                <el-col class="tr col_label"
                    :span="3">ip：&nbsp;&nbsp;&nbsp;</el-col>
                <el-col :span="4">
                    <el-col :span="16"
                        class="search_input_width">
                        <el-input size="small"
                            clearable
                            v-model="search_form.log_ip"></el-input>
                    </el-col>
                </el-col>
            </el-form-item>
            <el-form-item label="请求url：">
                <el-col :span="4">
                    <el-col :span="16"
                        class="search_input_width">
                        <el-input size="small"
                            clearable
                            v-model="search_form.log_url"></el-input>
                    </el-col>
                </el-col>
                <el-col class="tr col_label"
                    :span="3">操作id：&nbsp;&nbsp;&nbsp;</el-col>
                <el-col :span="4">
                    <el-col :span="16"
                        class="search_input_width">
                        <el-input size="small"
                            clearable
                            v-model="search_form.info_id"></el-input>
                    </el-col>
                </el-col>
                <el-col class="tr col_label"
                    :span="3">操作时间：&nbsp;&nbsp;&nbsp;</el-col>
                <el-col :span="4">
                    <el-col :span="16"
                        class="search_input_width">
                        <el-date-picker v-model="createTime"
                            style="width:300px"
                            type="datetimerange"
                            size="small"
                            align="right"
                            unlink-panels
                            value-format="timestamp"
                            range-separator="-"
                            clearable
                            start-placeholder="上传时间起"
                            end-placeholder="上传时间止">
                        </el-date-picker>
                    </el-col>
                </el-col>
            </el-form-item>

            <el-form-item>
                <el-row class="tl">
                    <el-col :span="24">
                        <el-button size="mini"
                            type="primary"
                            @click="search_btn">查询</el-button>
                        <el-button size="mini"
                            type="primary"
                            @click="del_search_btn">一键清除</el-button>
                    </el-col>
                </el-row>
            </el-form-item>

        </el-form>
    </div>
</template>
<script>
export default {
  name: "coinmust_search",
  data() {
    return {
      //  username  log_info  log_ip  log_url  info_id  created_time
      createTime: [],
      search_form: {
        username: "", //管理员
        log_info: "", //操作记录
        log_ip: "", //ip
        log_url: "", //请求url
        info_id: "", //操作id
        created_time_begin: "", //时间区间
        created_time_end: ""
      }
    };
  },
  components: {},
  methods: {
    del_search_btn() {
      this.search_form = {
        username: "", //管理员
        log_info: "", //操作记录
        log_ip: "", //ip
        log_url: "", //请求url
        info_id: "", //操作id
        created_time_begin: "", //时间区间
        created_time_end: ""
      };
      this.createTime = [];
      this.$emit("send_search", this.search_form);
    },
    search_btn() {
      this.$emit("send_search", this.search_form);
    }
  },
  watch: {
    createTime(val) {
      if (val != null) {
        this.search_form.created_time_begin = this.$fnc.phptime(val[0]);
        this.search_form.created_time_end = this.$fnc.phptime(val[1]);
      } else {
        this.search_form.created_time_begin = "";
        this.search_form.created_time_end = "";
      }
    }
  }
};
</script>
<style scoped>
</style>
